package com.java.demo.string;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * @auther zhangwj
 * @date 2020/8/21 1:48 下午
 */
public class Demo1 {


    public static void main(String[] args) {
        Node<String, String> node1 = new Node("1", "2", null);
        Node<String, String> node2 = new Node("1", "2", node1);
        Node<String, String>[] nodes = new Node[]{node2};
        for (Node<String, String> nodes1 = nodes[0]; nodes1 != null; nodes1 = node1.next) {
            System.out.println(nodes1);
        }
    }
}

class Node<K, V> {
    final K key;
    V value;
    Node<K, V> next;

    Node(K key, V value, Node<K, V> next) {
        this.key = key;
        this.value = value;
        this.next = next;
    }

    @Override
    public String toString() {
        return "Node{" +
                "key=" + key +
                ", value=" + value +
                ", next=" + next +
                '}';
    }
}